package Year22_Month04.day21;

public class 反转链表 {
    public ListNode reverseList(ListNode head) {
        ListNode node = null;//定义一个虚拟节点
        ListNode slow = head;
        ListNode fast = null;
        while(slow != null){
            fast = slow.next;
            slow.next = node;//进行反转
            //反转之后的处理
            node = slow;
            slow = fast;
        }
        return node;
    }
}
